package com.yilizhiyou.controller;

import com.yilizhiyou.common.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * 首页控制器
 *
 * @author 伊犁智游开发团队
 * @since 1.0.0
 */
@RestController
@RequestMapping("/")
public class HomeController {

    /**
     * 项目首页
     */
    @GetMapping("/")
    public Result<Map<String, Object>> home() {
        Map<String, Object> data = new HashMap<>();
        data.put("project", "伊犁智游");
        data.put("description", "基于AI的智慧文旅服务平台");
        data.put("version", "1.0.0");
        data.put("status", "运行中");
        data.put("timestamp", System.currentTimeMillis());
        
        Map<String, String> links = new HashMap<>();
        links.put("API文档", "/api/doc.html");
        links.put("健康检查", "/api/actuator/health");
        links.put("数据库监控", "/api/druid");
        links.put("用户注册", "/api/user/register");
        links.put("用户登录", "/api/user/login");
        links.put("景点列表", "/api/scenic-spot/list");
        
        data.put("links", links);
        
        return Result.success(data);
    }

    /**
     * 项目信息
     */
    @GetMapping("/info")
    public Result<Map<String, Object>> info() {
        Map<String, Object> data = new HashMap<>();
        data.put("name", "伊犁智游");
        data.put("description", "基于AI的智慧文旅服务平台");
        data.put("version", "1.0.0");
        data.put("author", "伊犁智游开发团队");
        data.put("technology", "Spring Boot + Vue 3 + AI");
        data.put("features", new String[]{
            "智能语音导览",
            "AI图像识别",
            "个性化推荐",
            "实时导航",
            "多语言支持"
        });
        
        return Result.success(data);
    }

    /**
     * 简单反馈接收，占位实现
     */
    @PostMapping("/feedback")
    public Result<Map<String, Object>> submitFeedback(@RequestBody Map<String, Object> body) {
        Map<String, Object> resp = new HashMap<>();
        resp.put("received", true);
        resp.put("echo", body);
        resp.put("ts", System.currentTimeMillis());
        return Result.success(resp);
    }
}
